\(\int \frac {(d+e x^r)^2 (a+b \log (c x^n))}{x} \, dx\) [382]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 104 \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=-\frac {2 b d e n x^r}{r^2}-\frac {b e^2 n x^{2 r}}{4 r^2}-\frac {1}{2} b d^2 n \log ^2(x)+\frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right ) \]

[Out]

-2*b*d*e*n*x^r/r^2-1/4*b*e^2*n*x^(2*r)/r^2-1/2*b*d^2*n*ln(x)^2+2*d*e*x^r*(a+b*ln(c*x^n))/r+1/2*e^2*x^(2*r)*(a+
b*ln(c*x^n))/r+d^2*ln(x)*(a+b*ln(c*x^n))

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {272, 45, 2372, 12, 14, 2338} \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )+\frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}-\frac {1}{2} b d^2 n \log ^2(x)-\frac {2 b d e n x^r}{r^2}-\frac {b e^2 n x^{2 r}}{4 r^2} \]

[In]

Int[((d + e*x^r)^2*(a + b*Log[c*x^n]))/x,x]

[Out]

(-2*b*d*e*n*x^r)/r^2 - (b*e^2*n*x^(2*r))/(4*r^2) - (b*d^2*n*Log[x]^2)/2 + (2*d*e*x^r*(a + b*Log[c*x^n]))/r + (
e^2*x^(2*r)*(a + b*Log[c*x^n]))/(2*r) + d^2*Log[x]*(a + b*Log[c*x^n])

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 272

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a
+ b*x)^p, x], x, x^n], x] /; FreeQ[{a, b, m, n, p}, x] && IntegerQ[Simplify[(m + 1)/n]]

Rule 2338

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))/(x_), x_Symbol] :> Simp[(a + b*Log[c*x^n])^2/(2*b*n), x] /; FreeQ[{a
, b, c, n}, x]

Rule 2372

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*(x_)^(m_.)*((d_) + (e_.)*(x_)^(r_.))^(q_.), x_Symbol] :> With[{u = I
ntHide[x^m*(d + e*x^r)^q, x]}, Dist[a + b*Log[c*x^n], u, x] - Dist[b*n, Int[SimplifyIntegrand[u/x, x], x], x]]
 /; FreeQ[{a, b, c, d, e, n, r}, x] && IGtQ[q, 0] && IntegerQ[m] &&  !(EqQ[q, 1] && EqQ[m, -1])

Rubi steps \begin{align*} \text {integral}& = \frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )-(b n) \int \frac {e x^r \left (4 d+e x^r\right )+2 d^2 r \log (x)}{2 r x} \, dx \\ & = \frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )-\frac {(b n) \int \frac {e x^r \left (4 d+e x^r\right )+2 d^2 r \log (x)}{x} \, dx}{2 r} \\ & = \frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )-\frac {(b n) \int \left (4 d e x^{-1+r}+e^2 x^{-1+2 r}+\frac {2 d^2 r \log (x)}{x}\right ) \, dx}{2 r} \\ & = -\frac {2 b d e n x^r}{r^2}-\frac {b e^2 n x^{2 r}}{4 r^2}+\frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right )-\left (b d^2 n\right ) \int \frac {\log (x)}{x} \, dx \\ & = -\frac {2 b d e n x^r}{r^2}-\frac {b e^2 n x^{2 r}}{4 r^2}-\frac {1}{2} b d^2 n \log ^2(x)+\frac {2 d e x^r \left (a+b \log \left (c x^n\right )\right )}{r}+\frac {e^2 x^{2 r} \left (a+b \log \left (c x^n\right )\right )}{2 r}+d^2 \log (x) \left (a+b \log \left (c x^n\right )\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.14 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.87 \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {1}{4} \left (\frac {e x^r \left (2 a r \left (4 d+e x^r\right )-b n \left (8 d+e x^r\right )\right )}{r^2}+4 a d^2 \log (x)+\frac {2 b e x^r \left (4 d+e x^r\right ) \log \left (c x^n\right )}{r}+\frac {2 b d^2 \log ^2\left (c x^n\right )}{n}\right ) \]

[In]

Integrate[((d + e*x^r)^2*(a + b*Log[c*x^n]))/x,x]

[Out]

((e*x^r*(2*a*r*(4*d + e*x^r) - b*n*(8*d + e*x^r)))/r^2 + 4*a*d^2*Log[x] + (2*b*e*x^r*(4*d + e*x^r)*Log[c*x^n])
/r + (2*b*d^2*Log[c*x^n]^2)/n)/4

Maple [A] (verified)

Time = 1.44 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.17

method result size
parallelrisch \(\frac {2 x^{2 r} \ln \left (c \,x^{n}\right ) b \,e^{2} r n +4 \ln \left (x \right ) a \,d^{2} n \,r^{2}+2 x^{2 r} a \,e^{2} n r -x^{2 r} b \,e^{2} n^{2}+8 x^{r} \ln \left (c \,x^{n}\right ) b d e r n +2 b \,d^{2} \ln \left (c \,x^{n}\right )^{2} r^{2}+8 x^{r} a d e n r -8 x^{r} b d e \,n^{2}}{4 r^{2} n}\) \(122\)
risch \(\frac {b \left (2 d^{2} \ln \left (x \right ) r +e^{2} x^{2 r}+4 d e \,x^{r}\right ) \ln \left (x^{n}\right )}{2 r}+\frac {i \pi b \,e^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2} x^{2 r}}{4 r}-\frac {i \pi b d e \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) x^{r}}{r}-\frac {i \pi b \,e^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right ) x^{2 r}}{4 r}-\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3}}{2}+\frac {i \pi b d e \,\operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2} x^{r}}{r}+\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}-\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i x^{n}\right ) \operatorname {csgn}\left (i c \,x^{n}\right )}{2}-\frac {i \pi b d e \operatorname {csgn}\left (i c \,x^{n}\right )^{3} x^{r}}{r}+\frac {i \pi b d e \,\operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2} x^{r}}{r}+\frac {i \ln \left (x \right ) \pi b \,d^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2}}{2}-\frac {i \pi b \,e^{2} \operatorname {csgn}\left (i c \,x^{n}\right )^{3} x^{2 r}}{4 r}+\frac {i \pi b \,e^{2} \operatorname {csgn}\left (i c \right ) \operatorname {csgn}\left (i c \,x^{n}\right )^{2} x^{2 r}}{4 r}-\frac {b \,d^{2} n \ln \left (x \right )^{2}}{2}+\frac {\ln \left (c \right ) b \,e^{2} x^{2 r}}{2 r}+\ln \left (x \right ) \ln \left (c \right ) b \,d^{2}+\frac {a \,e^{2} x^{2 r}}{2 r}-\frac {b \,e^{2} n \,x^{2 r}}{4 r^{2}}+\frac {2 \ln \left (c \right ) b d e \,x^{r}}{r}+\ln \left (x \right ) a \,d^{2}+\frac {2 a d e \,x^{r}}{r}-\frac {2 b d e n \,x^{r}}{r^{2}}\) \(487\)

[In]

int((d+e*x^r)^2*(a+b*ln(c*x^n))/x,x,method=_RETURNVERBOSE)

[Out]

1/4*(2*(x^r)^2*ln(c*x^n)*b*e^2*r*n+4*ln(x)*a*d^2*n*r^2+2*(x^r)^2*a*e^2*n*r-(x^r)^2*b*e^2*n^2+8*x^r*ln(c*x^n)*b
*d*e*r*n+2*b*d^2*ln(c*x^n)^2*r^2+8*x^r*a*d*e*n*r-8*x^r*b*d*e*n^2)/r^2/n

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.11 \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {2 \, b d^{2} n r^{2} \log \left (x\right )^{2} + {\left (2 \, b e^{2} n r \log \left (x\right ) + 2 \, b e^{2} r \log \left (c\right ) - b e^{2} n + 2 \, a e^{2} r\right )} x^{2 \, r} + 8 \, {\left (b d e n r \log \left (x\right ) + b d e r \log \left (c\right ) - b d e n + a d e r\right )} x^{r} + 4 \, {\left (b d^{2} r^{2} \log \left (c\right ) + a d^{2} r^{2}\right )} \log \left (x\right )}{4 \, r^{2}} \]

[In]

integrate((d+e*x^r)^2*(a+b*log(c*x^n))/x,x, algorithm="fricas")

[Out]

1/4*(2*b*d^2*n*r^2*log(x)^2 + (2*b*e^2*n*r*log(x) + 2*b*e^2*r*log(c) - b*e^2*n + 2*a*e^2*r)*x^(2*r) + 8*(b*d*e
*n*r*log(x) + b*d*e*r*log(c) - b*d*e*n + a*d*e*r)*x^r + 4*(b*d^2*r^2*log(c) + a*d^2*r^2)*log(x))/r^2

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 216 vs. \(2 (104) = 208\).

Time = 2.44 (sec) , antiderivative size = 216, normalized size of antiderivative = 2.08 \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\begin {cases} \left (a + b \log {\left (c \right )}\right ) \left (d + e\right )^{2} \log {\left (x \right )} & \text {for}\: n = 0 \wedge r = 0 \\\left (a + b \log {\left (c \right )}\right ) \left (d^{2} \log {\left (x \right )} + \frac {2 d e x^{r}}{r} + \frac {e^{2} x^{2 r}}{2 r}\right ) & \text {for}\: n = 0 \\\left (d + e\right )^{2} \left (\begin {cases} a \log {\left (x \right )} & \text {for}\: b = 0 \\- \left (- a - b \log {\left (c \right )}\right ) \log {\left (x \right )} & \text {for}\: n = 0 \\\frac {\left (- a - b \log {\left (c x^{n} \right )}\right )^{2}}{2 b n} & \text {otherwise} \end {cases}\right ) & \text {for}\: r = 0 \\\frac {a d^{2} \log {\left (c x^{n} \right )}}{n} + \frac {2 a d e x^{r}}{r} + \frac {a e^{2} x^{2 r}}{2 r} + \frac {b d^{2} \log {\left (c x^{n} \right )}^{2}}{2 n} - \frac {2 b d e n x^{r}}{r^{2}} + \frac {2 b d e x^{r} \log {\left (c x^{n} \right )}}{r} - \frac {b e^{2} n x^{2 r}}{4 r^{2}} + \frac {b e^{2} x^{2 r} \log {\left (c x^{n} \right )}}{2 r} & \text {otherwise} \end {cases} \]

[In]

integrate((d+e*x**r)**2*(a+b*ln(c*x**n))/x,x)

[Out]

Piecewise(((a + b*log(c))*(d + e)**2*log(x), Eq(n, 0) & Eq(r, 0)), ((a + b*log(c))*(d**2*log(x) + 2*d*e*x**r/r
 + e**2*x**(2*r)/(2*r)), Eq(n, 0)), ((d + e)**2*Piecewise((a*log(x), Eq(b, 0)), (-(-a - b*log(c))*log(x), Eq(n
, 0)), ((-a - b*log(c*x**n))**2/(2*b*n), True)), Eq(r, 0)), (a*d**2*log(c*x**n)/n + 2*a*d*e*x**r/r + a*e**2*x*
*(2*r)/(2*r) + b*d**2*log(c*x**n)**2/(2*n) - 2*b*d*e*n*x**r/r**2 + 2*b*d*e*x**r*log(c*x**n)/r - b*e**2*n*x**(2
*r)/(4*r**2) + b*e**2*x**(2*r)*log(c*x**n)/(2*r), True))

Maxima [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.10 \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\frac {b e^{2} x^{2 \, r} \log \left (c x^{n}\right )}{2 \, r} + \frac {2 \, b d e x^{r} \log \left (c x^{n}\right )}{r} + \frac {b d^{2} \log \left (c x^{n}\right )^{2}}{2 \, n} + a d^{2} \log \left (x\right ) - \frac {b e^{2} n x^{2 \, r}}{4 \, r^{2}} + \frac {a e^{2} x^{2 \, r}}{2 \, r} - \frac {2 \, b d e n x^{r}}{r^{2}} + \frac {2 \, a d e x^{r}}{r} \]

[In]

integrate((d+e*x^r)^2*(a+b*log(c*x^n))/x,x, algorithm="maxima")

[Out]

1/2*b*e^2*x^(2*r)*log(c*x^n)/r + 2*b*d*e*x^r*log(c*x^n)/r + 1/2*b*d^2*log(c*x^n)^2/n + a*d^2*log(x) - 1/4*b*e^
2*n*x^(2*r)/r^2 + 1/2*a*e^2*x^(2*r)/r - 2*b*d*e*n*x^r/r^2 + 2*a*d*e*x^r/r

Giac [F]

\[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\int { \frac {{\left (e x^{r} + d\right )}^{2} {\left (b \log \left (c x^{n}\right ) + a\right )}}{x} \,d x } \]

[In]

integrate((d+e*x^r)^2*(a+b*log(c*x^n))/x,x, algorithm="giac")

[Out]

integrate((e*x^r + d)^2*(b*log(c*x^n) + a)/x, x)

Mupad [F(-1)]

Timed out. \[ \int \frac {\left (d+e x^r\right )^2 \left (a+b \log \left (c x^n\right )\right )}{x} \, dx=\int \frac {{\left (d+e\,x^r\right )}^2\,\left (a+b\,\ln \left (c\,x^n\right )\right )}{x} \,d x \]

[In]

int(((d + e*x^r)^2*(a + b*log(c*x^n)))/x,x)

[Out]

int(((d + e*x^r)^2*(a + b*log(c*x^n)))/x, x)